<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>


<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>青麦门店系统</title>
<meta
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />

<!-- ================== BEGIN BASE CSS STYLE ================== -->
<%@ include file="../include/inc_head.jsp"%>
<!-- ================== END BASE CSS STYLE ================== -->

<!-- ================== BEGIN BASE JS ================== -->
<script src="/assets/plugins/pace/pace.min.js"></script>
<link href="/assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
 
<script type="text/javascript"    src="/assets/My97DatePicker/WdatePicker.js"></script>
<!-- ================== END BASE JS ================== -->
</head>
<body>
    <!-- begin #page-loader -->
    <div id="page-loader" class="fade in">
        <span class="spinner"></span>
    </div>
    <!-- end #page-loader -->

    <!-- begin #page-container -->
    <div id="page-container"
        class="fade page-sidebar-fixed page-header-fixed">
        <!-- begin #header -->
        <%@ include file="../include/inc_header.jsp"%>
        <!-- end #header -->

        <!-- begin #sidebar -->
        <%@ include file="../include/inc_left.jsp"%>
        <!-- end #sidebar -->

        <!-- begin #content -->
        <div id="content" class="content">
            <!-- begin breadcrumb -->
            <ol class="breadcrumb pull-right">
                <li><a href="javascript:;">首页</a></li>
                <li class="active">采购管理</li>
            </ol>
            <!-- end breadcrumb -->
            <!-- begin page-header -->
            <h1 class="page-header">采购管理</h1>
            <!-- end page-header -->

    <div class="panel panel-inverse">
                <div class="panel-heading">

                    <h4 class="panel-title">查询条件</h4>
                </div>
                <div class="panel-body">
                    <form class="form-inline" action="" method="POST">
                               
                                <div class="form-group m-r-10">
                                     <select class="form-control" id="applySource" name="className">
                                            <option value="">渠道来源</option>
                                            <option value="2">B端</option>
                                            <option value="1">C端</option>
                                             
                                      </select>
                                </div>
                                 <div class="form-group m-r-10">
                                   <select class="form-control" id="status" name="className">
                                            <option value="">采购状态</option>
                                            <option value="1">待入库</option>
                                            <option value="2">部分入库</option>
                                       <option value="3">全部入库</option>
                                       <option value="4">待确认</option>
                                       <option value="5">超时未入库</option>
                                             
                                      </select>
                                </div>
                                <div class="form-group m-r-10">
                                    <input id="s_time" name="s_time" class="Wdate" type="text" style="width: 150px" placeholder="日期开始"
                        onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'e_time\')||\'2020-10-01\'}'})" />
                                      - <input id="e_time" name="e_time" class="Wdate mr10" type="text" style="width: 150px" placeholder="日期结束"
                        onFocus="WdatePicker({minDate:'#F{$dp.$D(\'s_time\')}',dateFmt:'yyyy-MM-dd',maxDate:'2020-10-01'})" />
                                
                                 </div>
                                <button type="button" class="btn btn-sm btn-inverse m-r-5" onclick="doSearch();">查询</button>
                                <button type="button" class="btn btn-sm btn-inverse m-r-5" >导出采购单</button>
                            </form>
                    
                </div>
            </div>
            <div class="panel panel-inverse">
                <div class="panel-body">
                    <table id="data-table" class="table table-striped table-bordered">
                        
                    </table>
                </div>
            </div>

        </div>
        <!-- end #content -->

        <%@ include file="../include/inc_footer.jsp"%>
        <!-- begin scroll to top btn -->
        <a href="javascript:;"
            class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade"
            data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
        <!-- end scroll to top btn -->
    </div>
    <!-- end page container -->

    <!-- ================== BEGIN BASE JS ================== -->
    <%@ include file="../include/inc_foot.jsp"%>

    <!-- ================== END BASE JS ================== -->

    <!-- ================== BEGIN PAGE LEVEL JS ================== -->
    <script src="/assets/plugins/DataTables/media/js/jquery.dataTables.js"></script>
    <script src="/assets/plugins/DataTables/media/js/dataTables.bootstrap.min.js"></script>
    <script src="/assets/js/table-manage-default.demo.min.js"></script>
    <script src="/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="/assets/js/apps.min.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/jQueryEasyui/themes/gray/easyui.css">  
<link rel="stylesheet" type="text/css" href="/assets/jQueryEasyui/themes/icon.css">
<script type="text/javascript" src="/assets/jQueryEasyui/jquery.easyui.min.js"></script> 
<script type="text/javascript" src="/assets/jQueryEasyui/easyui-lang-zh_CN.js"></script> 

    <script>
    $(function() {

        var wid=window.screen.width;
        $('#data-table')
                .datagrid(
                        {
                            title : '采购管理',
                            loadMsg : '数据加载中,请稍后................',
                            nowrap : true,
                            striped : true,
                            url : '${ctx}/purchase/getList',
                            pagination : true,
                            rownumbers : true,
                            singleSelect : false,
                            border : true,
                            pageSize : '10',
                            columns : [ [
                                   /*  {
                                        field : 'check',
                                        checkbox : true
                                    }, */
                                    {
                                        field : 'id',
                                        title : '采购单ID',
                                        width :   wid*0.08,
                                        align : 'center'
                                    },
                                    {
                                        field : 'applySourceName',
                                        title : '渠道来源',
                                        width :   wid*0.08,
                                        align : 'center'
                                    } , {
                                        field : 'skuNum',//
                                        title : 'SKU数量',
                                        width :   wid*0.08,
                                        align : 'center'
                                    }, {
                                        field : 'totalPrice',// 
                                        title : '采购总价',
                                        width :   wid*0.08,
                                        align : 'center'
                                    },
                                    
                                    {
                                        field : 'deliveryDateTime',//ssu品牌 DeliveryDateTime
                                        title : '送货时间',
                                        width :   wid*0.08,
                                        align : 'center'
                                    }, 
                                    
                                    {
                                        field : 'applyDateTime',
                                        title : '申请时间',
                                        width :   wid*0.08,
                                        align : 'center'
                                    } ,
                                    {
                                        field : 'statusName',//  商品计价单位数量
                                        title : '采购状态',
                                        width :   wid*0.05,
                                        align : 'center'
                                    }  ,
                                    {
                                        field : 'applyTime',//
                                        hidden:'true'
                                    }  ,
                                    {
                                        field : 'deliveryTime',//
                                        hidden:'true'
                                    }  ,
                                    {
                                        field : 'tttt',
                                        title : '操作',
                                        align : 'center',
                                        width :   wid*0.08,
                                        formatter : function(value, rec, index) {
                                            var str ='<a href=${ctx}/purchase/detail?id='+rec.id+'&statusName='+rec.statusName+
                                                '&applyDateTime='+rec.applyTime+'&deliveryDateTime='+rec.deliveryTime+
                                                '&totalPrice='+rec.totalPrice+'&skuNum='+rec.skuNum+
                                                '&applySourceName='+rec.applySourceName+'>查看详情</a>';
                                            str +='<a style="margin-left:20px;" href=${ctx}/purchase/add?id='+rec.id+'&statusName='+rec.statusName+
                                                '&applyDateTime='+rec.applyTime+'&deliveryDateTime='+rec.deliveryTime+
                                                '&totalPrice='+rec.totalPrice+'&skuNum='+rec.skuNum+
                                                '&applySourceName='+rec.applySourceName+'>修改</a>';
                                            return str;
                                        }
                                    } ] ]
                        });
     var p = $('#data-table').datagrid('getPager');
        $(p).pagination({
            pageSize : 10,
            pageList : [ 10, 20, 30 ]
        });  

        //获取活动分类
    });
    
        //查询
    function doSearch() {
        $('#data-table').datagrid('load', {
            applySource : $("#applySource").val(),
            status :$("#status").val(),
            sTime : $('#s_time').val(),
            eTime : $('#e_time').val(),
        });
    }
    </script>
        <script>

        App.init();
    </script>

</body>
</html>


